Semantic vs Non-Semantic Text Formatting in HTML & CSS
Semantic tags convey meaning about the content to browsers, search engines, and assistive technologies, while non-semantic tags only affect visual appearance without conveying any meaning.
Semantic Tags: <strong>, <em>, <mark>, <cite>, <abbr>
Non-Semantic Tags: <b>, <i>, <u>
In this example, <strong> and <em> convey semantic meaning for assistive technologies, while <b> and <i> only change the appearance. Using CSS with semantic tags enhances both accessibility and design.
Semantic tags provide meaning, non-semantic tags only affect style.
Always prefer semantic tags for accessibility and SEO benefits.
CSS can enhance visual presentation without replacing semantic meaning.
Combine semantic HTML with CSS for both design and inclusivity.
If you need to make a piece of text bold on a landing page, would you use <b> or <strong>, and why?
How would you style a paragraph to look like a heading without changing the HTML markup? What are the implications?
What happens to screen readers when you replace a <strong> tag with a <span> styled with font-weight:bold?
We have a legacy component that uses <i> for icons and <b> for emphasis. Users report accessibility issues. How would you refactor it?
During a CSS refactor, a developer changed <em> to <span class='italic'> and the layout broke on some browsers. What could be causing that?
Why might a page's SEO ranking drop after replacing <h1> with a <div class='title'> styled via CSS?
Design a component library that enforces semantic markup while allowing flexible styling. What patterns would you use to prevent developers from falling back to non‑semantic tags?
Our large‑scale documentation site needs to support theming without sacrificing semantics. How would you structure the CSS and HTML to keep both concerns?
When migrating a monolith to a component‑based architecture, how do you handle existing non‑semantic tags to ensure accessibility and maintainability?
At the organization level, we want to audit all HTML for semantic correctness across dozens of services. What strategy, tooling, and governance would you propose?
If we decide to deprecate all presentational tags (<b>, <i>, <u>) in favor of CSS, how would you plan the rollout to minimize risk and technical debt?
Discuss the trade‑offs of enforcing strict semantic HTML in a fast‑moving startup versus a regulated‑industry product.